﻿ <!--Copyright 2010 http://tv4home.codeplex.com
This file is part of TV4Home.Client.QuickEPG.
TV4Home.Client.QuickEPG is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
TV4Home.Client.QuickEPG is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with TV4Home.Client.QuickEPG. If not, see http://www.gnu.org/licenses/. -->
    <UserControl x:Class="TV4Home.Client.Desktop.QuickEPG.TV4HomeQuickEPGUserControl"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:my="clr-namespace:TV4Home.Client.Desktop.QuickEPG"
             mc:Ignorable="d" 
             Margin="0" MinWidth="641" MinHeight="300" Loaded="UserControl_Loaded">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Assets/CoreStyles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <my:DateTimeConverter x:Key="dateConverter"/>
            <Style x:Key="MyFocusVisual">
                <Setter Property="Control.Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Control}">
                            <Grid Margin="8">
                                <Ellipse
                    Name="r1"
                    Stroke="Black"
                    StrokeDashArray="2 2"
                    StrokeThickness="1"/>
                                <Border
                    Name="border"
                    Width="{TemplateBinding ActualWidth}"
                    Height="{TemplateBinding ActualHeight}"
                    BorderThickness="1"
                    CornerRadius="2"/>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style x:Key="CircleButton" TargetType="Button" >
                <Setter Property="OverridesDefaultStyle" Value="True"/>
                <Setter Property="Margin" Value="2"/>
                <Setter Property="FocusVisualStyle" Value="{StaticResource MyFocusVisual}"/>
                <Setter Property="Background" Value="#FF6DB4EF"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Button">
                            <Grid>
                                <Ellipse Fill="{TemplateBinding Background}"/>
                                <Ellipse>
                                    <Ellipse.Fill>
                                        <RadialGradientBrush>
                                            <GradientStop Offset="0" Color="#00000000"/>
                                            <GradientStop Offset="0.88" Color="#00000000"/>
                                            <GradientStop Offset="1" Color="#80000000"/>
                                        </RadialGradientBrush>
                                    </Ellipse.Fill>
                                </Ellipse>
                                <Ellipse Margin="10" x:Name="highlightCircle" >
                                    <Ellipse.Fill >
                                        <LinearGradientBrush >
                                            <GradientStop Offset="0" Color="#50FFFFFF"/>
                                            <GradientStop Offset="0.5" Color="#00FFFFFF"/>
                                            <GradientStop Offset="1" Color="#50FFFFFF"/>
                                        </LinearGradientBrush>
                                    </Ellipse.Fill>
                                </Ellipse>
                                <ContentPresenter x:Name="content" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsPressed" Value="True">
                                    <Setter TargetName="highlightCircle" Property="Fill">
                                        <Setter.Value>
                                            <LinearGradientBrush StartPoint="0.3,0" EndPoint="0.7,1">
                                                <GradientStop Offset="0" Color="#50FFFFFF"/>
                                                <GradientStop Offset="0.5" Color="#00FFFFFF"/>
                                                <GradientStop Offset="1" Color="#50FFFFFF"/>
                                            </LinearGradientBrush>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter TargetName="content" Property="RenderTransform">
                                        <Setter.Value>
                                            <TranslateTransform Y="0.5" X="0.5"/>
                                        </Setter.Value>
                                    </Setter>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="288*" />
            <ColumnDefinition Width="353*" />
        </Grid.ColumnDefinitions>
        <!--<Rectangle Margin="3" Stroke="#FF2D2D2D" Fill="Transparent" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.ColumnSpan="2">
            <Rectangle.Effect>
                <DropShadowEffect Opacity="0.695" BlurRadius="14" ShadowDepth="0" Color="#FF434343"/>
            </Rectangle.Effect>
        </Rectangle>-->
      
            <TreeView BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" x:Name="tVEpg" Margin="7,7,7,7" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"  TreeViewItem.Selected="tVEpg_Selected" >
            <TreeView.ItemContainerStyle>
                <Style TargetType="{x:Type TreeViewItem}">
                    <EventSetter Event="Selected" Handler="tVEpg_Selected" />
                    <Style.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Background" Value="LightGray" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </TreeView.ItemContainerStyle>

        </TreeView>


        <TextBox MaxHeight="25" Margin="8,35,12,0" Name="tbProgramTitle" VerticalAlignment="Top" Grid.Column="1" AcceptsTab="False" IsReadOnly="True" Opacity="0.6" Visibility="Hidden" />
        <TextBox  HorizontalAlignment="Stretch" Margin="8,90,12,10" Name="tbProgramDescription" VerticalAlignment="Stretch" AcceptsReturn="True" TextWrapping="Wrap" Grid.Column="1" IsReadOnly="True" BorderThickness="0.6" Visibility="Hidden" />
        <Label Content="Titel:" Grid.Column="1" Height="25" HorizontalAlignment="Left" Margin="8,8,0,0" Name="lblTitle" VerticalAlignment="Top" Width="38" Visibility="Hidden" />
        <Label Content="Beschreibung:" Grid.Column="1" Height="28" HorizontalAlignment="Left" Margin="8,65,0,0" Name="lblDescription" VerticalAlignment="Top" Width="102" Visibility="Hidden" />
        <Button Visibility="Hidden"  Content="" Grid.Column="1" MaxHeight="17" MinHeight="17" MinWidth="17" MaxWidth="17" HorizontalAlignment="Left" Margin="324,8,0,0" Name="btnRecordSelected" VerticalAlignment="Top"  Style="{StaticResource CircleButton}" Background="#FF9F1014" Click="btnRecordSelected_Click" />
        <ListBox Grid.Column="1" HorizontalAlignment="Stretch" Margin="5" Name="lbSchedules" VerticalAlignment="Stretch" Visibility="Visible">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Border>
                        <Grid >
                            <Rectangle Margin="0" Stroke="#FF2D2D2D" Fill="Transparent" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                                <Rectangle.Effect>
                                    <DropShadowEffect Opacity="0.695" BlurRadius="14" ShadowDepth="0" Color="#FF434343"/>
                                </Rectangle.Effect>
                            </Rectangle>
                            <StackPanel Margin="3">
                                <DockPanel >
                                    <TextBlock FontWeight="Bold" Text="Sendung:" DockPanel.Dock="Left" Margin="5,0,10,0"/>                                   
                                </DockPanel>
                                <DockPanel >
                                    <TextBlock Text=" " />
                                    <TextBlock FontWeight="Bold" Text="{Binding Path=ProgramName}"  />
                                </DockPanel>
                                <DockPanel >
                                    <TextBlock FontWeight="Bold" Text="Beginn:" DockPanel.Dock="Left" Margin="5,0,5,0"/>
                                    <TextBlock Text="  " />
                                    <TextBlock Text="{Binding Path=StartTime,Converter={StaticResource dateConverter}}" />
                                </DockPanel>
                                <DockPanel >
                                    <TextBlock FontWeight="Bold" Text="Ende:" DockPanel.Dock="Left" Margin="5,0,5,0"/>
                                    <TextBlock Text="  " />
                                    <TextBlock Text="{Binding Path=EndTime,Converter={StaticResource dateConverter}}" />
                                </DockPanel>
                            </StackPanel>
                        </Grid>
                    </Border>
                </DataTemplate>
            </ListBox.ItemTemplate>
            <ListBox.ItemContainerStyle>
                <Style TargetType="ListBoxItem">
                    <Setter Property="MaxWidth" Value="400"/>
                    <!--<EventSetter Event="ListBoxItem.Selected" Handler="lbRecordings_Selected" HandledEventsToo="True"/>-->
                </Style>
            </ListBox.ItemContainerStyle>
        </ListBox>
    </Grid>
</UserControl>
